#ifndef _GA
#define _GA

#include <vector>
#include <time.h>
#include <cv.h>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/discrete_distribution.hpp>

using namespace std;
using namespace cv;

class GA {
    vector<Mat> population;
    vector<Mat> prevPopulation;
    vector<double> comp;
    void complexCompare(Mat, Mat);
public:
    GA(int); // constructor
    bool compare(Mat, Mat); // compare two matrices for ordering

    void randomInit(); // randomly initialize population

    double complexity(Mat); // compute complexity of certain matrix

    void crossOver(*Mat, *Mat); // crossover two members
    void mutate(*Mat); // mutate member

    void updateComplexities(); // update all complexities of population
    void sort(); // sort current population by complexity
    void advance(); // copy current population to previousp population

};

#endif
